<script setup lang="ts">
import {ref,defineProps} from 'vue'
const props=defineProps({
    modelValue: {
    type: [String, Number, Date, Array],
    default: () => null
  },
  type: {
    type: String,
    default: () => 'date'
  },
  label: {
    type: String,
    default: () => '日期'
  },
  format: {
    type: String,
    default: () => 'YYYY-MM-DD'
  },
  defaultValue: {
    type: [Date, Array],
    default: () => null
  },
  disabled: {
    type: Boolean,
    default: () => false
  },
  clearable: {
    type: Boolean,
    default: () => true
  }
})
const inputValue=ref(props.modelValue? props.modelValue:'')
const emit=defineEmits(['update:modelValue'])

</script>

<template>
   <el-date-picker
    v-model="inputValue"
    class="!w-full"
    :type="props.type"
    :format="props.format"
    :value-format="props.format"
    :placeholder="'请选择' + props.label"
    :default-value="props.defaultValue"
    :disabled="props.disabled"
    :clearable="props.clearable"
    @change="emit('update:modelValue',inputValue)"
  />
</template>

<style scoped></style>